package device_os

import (
	"context"
	"qabx.net/safe-app-center/api/device_os_api"
	"qabx.net/safe-app-center/pkg/model"
)

type DeviceOsServerImpl struct {
	device_os_api.UnimplementedDeviceOsApiServiceServer
}

func (s DeviceOsServerImpl) PushDeviceOsInfo(ctx context.Context, req *device_os_api.DeviceOsRequest) (resp *device_os_api.DeviceOsResponse, err error) {
	resp = &device_os_api.DeviceOsResponse{
		Code:    200,
		Message: "",
	}
	info := model.TblDeviceInfo{
		DeviceMac: req.DeviceMac,
		OsName:    req.OsInfo,
	}
	//记录设备与系统指纹进行关联信息
	_, err = info.AddAndUpdateDeviceInfoByMac()
	if err != nil {
		resp.Code = 201
	}
	return
}
